import request from '@/utils/request'

// 查询商品规格关联列表
export function listRelation1(query) {
  return request({
    url: '/lkshop/relation1/list',
    method: 'get',
    params: query
  })
}

// 查询商品规格关联详细
export function getRelation1(id) {
  return request({
    url: '/lkshop/relation1/' + id,
    method: 'get'
  })
}

// 查询商品规格关联详情（包含规格值）
export function getRelation1Detail(id) {
  return request({
    url: '/lkshop/relation1/detail/' + id,
    method: 'get'
  })
}

// 查询商品规格关联详情（从SKU表获取商品对应的具体规格值）
export function getRelation1DetailWithSku(id) {
  return request({
    url: '/lkshop/relation1/detailWithSku/' + id,
    method: 'get'
  })
}

// 从SKU表获取商品对应的具体规格值
export function getSpecsFromSku(id) {
  return request({
    url: '/lkshop/relation1/specsFromSku/' + id,
    method: 'get'
  })
}

// 新增商品规格关联
export function addRelation1(data) {
  return request({
    url: '/lkshop/relation1',
    method: 'post',
    data: data
  })
}

// 修改商品规格关联
export function updateRelation1(data) {
  return request({
    url: '/lkshop/relation1',
    method: 'put',
    data: data
  })
}

// 删除商品规格关联
export function delRelation1(id) {
  return request({
    url: '/lkshop/relation1/' + id,
    method: 'delete'
  })
}
